/* 
 * File:   init.h
 * Author: Bram
 *
 * Created on 1 december 2014, 21:49
 */

#ifndef INIT_H
#define	INIT_H

#ifdef	__cplusplus
extern "C" {
#endif



#define COMMAND_NACK     0x00
#define COMMAND_ACK      0x01
#define COMMAND_READ_PM  0x02
#define COMMAND_WRITE_PM 0x03
#define COMMAND_WRITE_CM 0x07
#define COMMAND_RESET    0x08
#define COMMAND_READ_ID  0x09

#define PM_ROW_SIZE 64
#define CM_ROW_SIZE 8
#define CONFIG_WORD_SIZE 1

#define PM_ROW_ERASE 		0x4042
#define PM_ROW_WRITE 		0x4001
#define CONFIG_WORD_WRITE	0X4000
#define PM_WORD_WRITE       0x4003

typedef short          Word16;
typedef unsigned short UWord16;
typedef long           Word32;
typedef unsigned long  UWord32;
typedef union tuReg32
{
        UWord32 Val32;
        /* EasyCODE C */
        struct
        {
                UWord16 LW;
                UWord16 HW;
        }Word;
        /* EasyCODE E */
        char Val[4];
}uReg32;


uReg32 boot_getflashword(UWord32 source);
void boot_erasepage(UWord32 source);
void boot_setflashword(UWord32 source, UWord32 value);
void boot_writerow();
    
void boot_initport();
void boot_initclock();
void boot_init_comm();


#ifdef	__cplusplus
}
#endif

#endif	/* INIT_H */

